/* 奶油系渐变背景 + 星星动效 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    height: 100vh;
    background: linear-gradient(120deg, #fffaf0, #fdeff2);
    overflow: auto;  /* 修改为auto允许滚动 */
    position: relative;
  }
  
  /* 星星背景容器 */
  .starry-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
  }
  
  .starry-bg::before,
  .starry-bg::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#fff 1px, transparent 1px),
                      radial-gradient(#ffe4e1 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-animation: twinkle 8s linear infinite;
    animation: twinkle 8s linear infinite;
}

@-webkit-keyframes twinkle {
    0% {
        -webkit-transform: translateY(0) rotate(0deg);
    }
    100% {
        -webkit-transform: translateY(-20px) rotate(360deg);
    }
}
  
  .starry-bg::after {
    background-size: 80px 80px;
    animation-duration: 12s;
    opacity: 0.4;
  }
  
  @keyframes twinkle {
    0% {
      transform: translateY(0) rotate(0deg);
    }
    100% {
      transform: translateY(-20px) rotate(360deg);
    }
  }
  
/* 页面内容样式 */
.container {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-top: 0;
    top: 60%;  /* 从50%调整为60% */
    transform: translateY(-50%);  /* 向上偏移自身高度的一半 */
    padding: 2em;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(255, 182, 193, 0.3);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  h1 {
    color: #d17b94;
    font-size: 2rem;
  }
  
  #countdown {
    margin: 1.5rem 0;
  }
  
  #wishing-tree {
    margin-top: 2rem;
  }
  
  #wish-list {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
  }
  
  #wish-list li {
    background: #fce4ec;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 12px;
  }
  
  input[type="text"] {
    padding: 0.5rem;
    width: 70%;
    border: 1px solid #ccc;
    border-radius: 12px;
  }
  
/* 奶油风按钮 */
button {
    padding: 0.8em 1.5em;
    font-size: 1rem;
    background-color: #ff9e9e;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 158, 158, 0.4);
    transition: transform 0.2s ease;
    margin: 1rem 0;
}

.love-button:hover {
    transform: scale(1.05);
}

.love-message {
    margin: 1rem 0;
    color: #d17b94;
    font-size: 1.2rem;
    min-height: 2rem;
    text-align: center;
    font-style: italic;
    transition: opacity 0.5s ease;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.3);
}

.heart {
    position: absolute;
    font-size: 2rem;
    color: #ff9e9e;
    animation: fadeOut 2s forwards;
    pointer-events: none;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* 奶油风按钮 */
button {
    padding: 0.8em 1.5em;
    font-size: 1rem;
    background-color: #ffe4e1;
    color: #cc3366;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.4);
    transition: transform 0.2s ease, background-color 0.3s ease;
  }
  
  button:hover {
    transform: scale(1.05);
    background-color: #ffd1dc;
  }

/* 蛋糕容器样式 */
.cake-container {
    position: relative;
    margin: 2rem auto;
    width: 200px;
    height: 200px;
    text-align: center;
    font-size: 1.5rem;
    line-height: 1;
    color: #d17b94;
}

.cake {
    position: relative;
    width: 100%;
    height: 100%;
}

.plate {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 30px;
    background: #f8f8f8;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px;
}

.layer.bottom {
    bottom: 30px;
    width: 160px;
    height: 60px;
    background: linear-gradient(to bottom, #f9c5d1, #f2789f);
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.1);
}

.layer.middle {
    bottom: 80px;
    width: 130px;
    height: 50px;
    background: linear-gradient(to bottom, #f9c5d1, #f2789f);
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.1);
}

.layer.top {
    bottom: 120px;
    width: 100px;
    height: 40px;
    background: linear-gradient(to bottom, #f9c5d1, #f2789f);
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.1);
}

.candle {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 30px;
    background: linear-gradient(to bottom, #ff9a9e, #fad0c4);
    border-radius: 4px;
}

.flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 24px;
    background: radial-gradient(#ffde7d, #ff9e7d, transparent 70%);
    border-radius: 50% 50% 20% 20%;
    animation: flicker 1.5s ease-in-out infinite alternate;
    filter: blur(1px);
    box-shadow: 0 0 10px #ff9e7d;
}

@keyframes flicker {
    0%, 100% {
        transform: translateX(-50%) scale(1) rotate(-2deg);
    }
    50% {
        transform: translateX(-50%) scale(1.1, 0.9) rotate(2deg);
    }
}

.cake-svg {
    width: 100%;
    height: 100%;
}

.flame {
    animation: flicker 2s ease-in-out infinite alternate;
    transform-origin: 50% 100%;
    filter: url(#flame-blur);
}

@keyframes flicker {
    0%, 100% {
        transform: scale(1, 1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05, 0.98);
        opacity: 0.95;
    }
}

.wish-form {
    margin-top: 2rem;
}

#wish-text {
    width: 80%;
    height: 150px;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #ccc;
    margin-bottom: 1rem;
    resize: none;
}

.wish-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;  /* 增加间距 */
    margin: 2rem auto;
    max-width: 500px;  /* 缩小容器宽度 */
}

.wish-box {
    position: relative;
    margin: auto;
    width: 100px;
    height: 100px;
    background: none; /* 移除渐变背景 */
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(255, 158, 158, 0.3);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
}

.wish-box::before {
    display: none; 
}
.wish-box:nth-child(1) { background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%); }
.wish-box:nth-child(2) { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.wish-box:nth-child(3) { background: linear-gradient(135deg, #ffc3a0 0%, #ffafbd 100%); }
.wish-box:nth-child(4) { background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%); }
.wish-box:nth-child(5) { background: linear-gradient(135deg, #a6c1ee 0%, #fbc2eb 100%); }
.wish-box:nth-child(6) { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.wish-box:nth-child(7) { background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }
.wish-box:nth-child(8) { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.wish-box:nth-child(9) { background: linear-gradient(135deg, #fdcbf1 0%, #e6dee9 100%); }

.wish-box:hover {
    transform: translateY(-5px);
}

.wish-box.open {
    animation: jumpAndDisappear 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.wish-note {
    position: relative;
    margin: 0 auto;  /* 水平居中 */
    width: 80%;
    max-width: 400px;
    height: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #fffaf0, #fdeff2);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(255, 182, 193, 0.5);
    border: 3px solid #ff9e9e;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    /* animation-delay: 0.3s; */
}

@keyframes jumpAndDisappear {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-80px) scale(0);
        opacity: 0;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.wish-note.active {
    opacity: 1;
}

.wish-box {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wish-note::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 100px;
    height: 100px;
    background: url('../images/gift_ribbon.png') no-repeat;
    background-size: contain;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.wish-content {
    padding: 10px;
    color: #d17b94;
    font-size: 1rem;
    word-break: break-word;
    opacity: 0;
    transition: opacity 0.3s ease 0.4s;
}

.wish-box.open .wish-content {
    opacity: 1;
}

.wish-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.wish-buttons button {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#confirm-wish {
    background-color: #fa9ec3;
    color: white;
}

#try-again {
    background-color: #f0f0f0;
    color: #333;
}

.wish-buttons button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.wish-item {
    position: relative;
    background: #fce4ec;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.3);
    transition: all 0.3s ease;
}

.wish-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.4);
}
.wish-box:hover {
    transform: translateY(-5px);
}

.cake-tip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    color: #d17b94;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    animation: blinkFiveTimes 10s forwards;
    opacity: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255, 182, 193, 0.3);
}

@keyframes blinkFiveTimes {
    0%, 100% { opacity: 0; }
    10%, 30%, 50%, 70%, 90% { opacity: 1; }
    20%, 40%, 60%, 80% { opacity: 0; }
}


/* 首页container样式 */
.home-container {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-top: 0;
    top: auto;  /* 移除百分比定位 */
    margin-top: 100px;  /* 使用固定间距 */
    transform: none;  /* 移除transform偏移 */
    /* top: 60%;
    transform: translateY(-50%); */
    padding: 2em;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(255, 182, 193, 0.3);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* 愿望页container样式 */
.wish-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    text-align: center;
    margin: 2rem auto;
    padding: 2em;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(255, 182, 193, 0.4);
    max-width: 800px;
    min-width: 80vw;  /* 添加最小宽度为视口宽度的60% */
    width: auto;      /* 修改宽度为自动 */
}

.balloon-container {
    position: fixed;
    bottom: -100px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
  }
  
  .balloon {
    position: absolute;
    bottom: 0;
    width: 40px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ffb6c1, #ff69b4);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: float 10s linear infinite;
    opacity: 0.8;
  }
  
  @keyframes float {
    0% {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    100% {
      transform: translateY(-120vh) scale(1.1);
      opacity: 0;
    }
  }
  